package com.qlm.interceptor;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;
import com.qlm.view.AdminView;
/**
 * 记录操作日志拦截器
 * @author Administrator
 *
 */
public class AdminOperate2Interceptor implements Interceptor{
	protected final static Logger      logger = LoggerFactory.getLogger(AdminOperate2Interceptor.class);
	@Override
	public void intercept(Invocation inv) {		
		Controller controller = inv.getController();
		AdminView admin = inv.getController().getSessionAttr("adminView");
		int roleId = admin.getRoleId();
		if(roleId==1 || roleId==2 || roleId==3){
			inv.invoke();
		}else{
			controller.renderJsp("/page/unauthorized.jsp");
		}
	}
}
